import request from "../util/request";

/**
 * 添加用户信息
 * @returns {Promise<AxiosResponse<any>>}
 */
export const addUser = function () {
    return request.get("/user/add")
}

/**
 * 编辑用户信息
 * @param userId
 * @returns {Promise<AxiosResponse<any>>}
 */
export const editUser = function (userId) {
    return request.get(`/user/edit/${userId}`)
}

/**
 * 获取用户角色信息
 * @param userId
 */
export const userRole = function (userId) {
    return request.get(`/user-role/get/${userId}`)
}

/**
 * 获取用户列表
 * @param current
 * @param size
 */
export const userList = function (current, size) {
    return request.get(`/user/list/${current}/${size}`)
}

/**
 * 获取用户信息
 * @param userId
 */
export const userInfo = function (userId) {
    return request.get(`/user-role/get/${userId}`)
}

/**
 * 保存用户信息
 * @param roleId
 * @param userInfo
 * @returns {Promise<AxiosResponse<any>>}
 */
export const userSave = function (roleId, userInfo) {
    return request.put(`/user/save/role/${roleId}`, userInfo)
}

/**
 * 删除用户信息
 * @param userId
 */
export const userDelete = function (userId) {
    return request.delete(`/user/delete/${userId}`)
}